package com.bawei.module_main.ui.main

import androidx.lifecycle.MutableLiveData
import com.bawei.lib_common.base.BaseViewModel
import com.bawei.module_main.model.UpdateModel
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

/**
 *作者：lxy
 *功能:
 *时间：2025/5/27
 */
@HiltViewModel
class MainViewModel @Inject constructor(private val mRepository: MainRepository) : BaseViewModel() {

    private val appUpdateLiveData by lazy {
        MutableLiveData<UpdateModel>()
    }

    val appUpdateLiveData_ get() = appUpdateLiveData

    fun checkUpdate() {
        execute(
            action = mRepository.checkUpdate(),
            onFinish = {
                appUpdateLiveData.value = it.data
            }
        )
    }
}